<?php
/**
* 扫码队列
* @DateTime 2018-06-06
* @author xyl
*/
class QRList_model extends MY_Model
{

	private $table='qrlist';

	function __construct()
	{
		parent::__construct();

	}

	/**
	 * 增加积分
	 * @author XYL
	 * @DateTime 2018-06-04
	 * @param    [type]     $user_id [description]
	 * @param    [type]     $score   [description]
	 */
	public function addlist($post)
	{
		$where = $post;
		$where['del_status'] = 0;
		$info = $this->hw_getRecord($this->table,$where);
		if (!empty($info)) {
			return true;
		} else {
			$res = $this->hw_Insert($this->table,$post);
			return $res;
		}
	}

	/**
	 * 获取最后一个扫码的人
	 * @author XYL
	 * @DateTime 2018-06-06
	 * @return   [type]     [description]
	 */
	public function get_last_user()
	{
		$where = array(
			'del_status'	=>	0,
		);
		$info = $this->hw_getRecord($this->table,$where,'*','create_time desc');
		return $info;
	}

	/**
	 * 清除队列
	 * @author XYL
	 * @DateTime 2018-06-06
	 * @param    [type]     $id [description]
	 * @return   [type]         [description]
	 */
	public function remove_list($id)
	{
		$update = array(
			'del_status'	=>	1,
			'update_time'	=>	date('Y-m-d H:i:s'),
		);
		$this->hw_Update($this->table,$update,array('id'=>$id));
	}
}